use ibm_db::{ODBCConnectionManager,Statement,ResultSetState::Data};
use std::sync::Mutex;
use std::env;
pub mod db2query;
//获取连接池
pub fn getPool() -> r2d2::Pool<ODBCConnectionManager> {

    let manager = ODBCConnectionManager::new(
        format!("DATABASE={};HOSTNAME={};PORT={};UID={};PWD={};"
        ,env::var("DATABASE").unwrap()
        ,env::var("HOSTNAME").unwrap()
        ,env::var("PORT").unwrap()
        ,env::var("UID").unwrap()
        ,env::var("DBPWD").unwrap()
        )
        
        );
        r2d2::Pool::new(manager).unwrap()    
}

lazy_static! { 
    pub static ref DB2POOL: r2d2::Pool<ODBCConnectionManager>= {
       
        getPool()
    };
}